﻿using Microsoft.WindowsAzure.Storage.Table;
using System;

namespace AzureLogManager.Log
{
    public class LogEntity : TableEntity
    {
        public LogEntity() { }

        public LogEntity(String message, String type, Double duration, String ipAddress)
        {
            this.RowKey = Guid.NewGuid().ToString();
            this.PartitionKey = String.Format("Log_{0}_{1}_{2}", DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day);
            this.Message = message;
            this.Type = type;
            this.Duration = duration;
            this.IPAddress = ipAddress;
        }

        public String Message { get; set; }
        public String Type { get; set; }
        public Double Duration { get; set; }
        public String IPAddress { get; set; }

        public static class LogType
        {
            public static String Message = "Message";
            public static String Error = "Error";
            public static String ClientError = "ClientError";
        }
    } 
}
